import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
import { Observable } from 'rxjs';

@Injectable()
export class AuthGuard implements CanActivate {
  canActivate(
    context: ExecutionContext,
  ): boolean | Promise<boolean> | Observable<boolean> {
    // 在此处编写守卫的逻辑
    const request = context.switchToHttp().getRequest();
    return !!request.user; // 假设用户对象存在，表示已登录
  }
}
